package net.studou.interceptor;

import net.studou.action.BasicAction;
import net.studou.vo.VMessage;
import net.studou.vo.VUser;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AuthorityInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = 1358600090729208361L;

	// 拦截Action处理的拦截方法
	@SuppressWarnings("unchecked")
	public String intercept(ActionInvocation invocation) throws Exception {
		ActionContext ctx = invocation.getInvocationContext();
		VUser user = (VUser) ctx.getSession().get("userInfo");

//		if (user != null) {
			return invocation.invoke();
//		} else {
//			BasicAction basicAction = (BasicAction) invocation.getAction();
//			basicAction.setFeedBackMesssage(new VMessage(VMessage.ERROR, "登录提示", "您还没有登录，不能进行此项操作，请登录。"));
//			return Action.LOGIN;
//		}
	}
}